#include "tou.h"
#include "detectionAssist.h"

//查找添加账号
void addFriend(BUF *BF)
{
    printf("请输入查找账号:");
    scanf("%s",BF->buf);
    getchar();
    int ret=Detection(BF);
    if(ret==1)
    {
        char xuan[8];
        printf("存在账号是否添加？(y/n)\n");
        scanf("%s",xuan);
        if(!strcmp(xuan,"y"))
        {
            BF->choice=ADDFREIND;
            write(SERVERFD,BF,sizeof(BUF));
            printf("添加成功等待对方同意。\n");
        }
        else if(!strcmp(xuan,"n")){}
        else{printf("输入错误。\n");}
    }
    else if(ret==0)
    {
        printf("不存在该账号。\n");
    }
    return;
}